home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d1
/
listcmos.arc
/
LISTCMOS.C
next >
Wrap
C/C++ Source or Header
|
1989-06-10
|
11KB
|
191 lines
#include "stdio.h"
#include "conio.h"
#include "ctype.h"
char cmos[64];
int i;
void printdesc();
void main(argc,argv)
int argc;
char *argv[];
{
/* Read all the CMOS RAM memory (64 bytes) */
for (i=0; i<64; i++) {
outp(0x70, i);
cmos[i] = (char) inp(0x71);
}
/* Display all the information */
printf(" ┌────────────────────────────────────────────┐\n");
printf(" │ AT CMOS Ram List - Ed Luebke (Version 1.1) │\n");
printf("┌──────┬─────┬───┴─────────────────────╥──────┬─────┬─────────┴───────────────┐\n");
printf("│ Byte │Value│ Description ║ Byte │Value│ Description │\n");
printf("├──────┼─────┼─────────────────────────╫──────┼─────┼─────────────────────────┤\n");
printf("│ 00 │ %02X │ Seconds ║ 14 │ %02X │ Equipment byte │\n", cmos[0], cmos[0x14]);
printf("│ 01 │ %02X │ Seconds (alarm) ║ 15 │ %02X │ Low base memory │\n", cmos[1], cmos[0x15]);
printf("│ 02 │ %02X │ Minutes ║ 16 │ %02X │ High base memory │\n", cmos[2], cmos[0x16]);
printf("│ 03 │ %02X │ Minutes (alarm) ║ 17 │ %02X │ Low Expansion Memory │\n", cmos[3], cmos[0x17]);
printf("│ 04 │ %02X │ Hours ║ 18 │ %02X │ High Expansion Memory │\n", cmos[4], cmos[0x18]);
printf("│ 05 │ %02X │ Hours (alarm) ║19-2d │ │ Reserved │\n", cmos[5]);
printf("│ 06 │ %02X │ Day of week ║ │ │ %02X %02X %02X %02X %02X %02X %02X %02X │\n",
cmos[6], cmos[0x19], cmos[0x1a], cmos[0x1b], cmos[0x1c], cmos[0x1d],
cmos[0x1e], cmos[0x1f], cmos[0x20]);
printf("│ 07 │ %02X │ Date of month ║ │ │ %02X %02X %02X %02X %02X %02X %02X %02X │\n",
cmos[7], cmos[0x21], cmos[0x22], cmos[0x23], cmos[0x24], cmos[0x25],
cmos[0x26], cmos[0x27], cmos[0x28]);
printf("│ 08 │ %02X │ Month ║ │ │ %02X %02X %02X %02X %02X │\n",
cmos[8], cmos[0x29], cmos[0x2a], cmos[0x2b], cmos[0x2c], cmos[0x2d]);
printf("│ 09 │ %02X │ Year ║ 2e │ %02X │ CMOS checksum (high) │\n", cmos[9], cmos[0x2e]);
printf("│ 0a │ %02X │ Status Reg A ║ 2f │ %02X │ CMOS checksum (low) │\n", cmos[0x0a], cmos[0x2f]);
printf("│ 0b │ %02X │ Status Reg B ║ 30 │ %02X │ Low expansion memory │\n", cmos[0x0b], cmos[0x30]);
printf("│ 0c │ %02X │ Status Reg C ║ 31 │ %02X │ High expansion memory │\n", cmos[0x0c], cmos[0x31]);
printf("│ 0d │ %02X │ Status Reg D ║ 32 │ %02X │ Date century │\n", cmos[0x0d], cmos[0x32]);
printf("│ 0e │ %02X │ Diagnostic status ║ 33 │ %02X │ Information flags │\n", cmos[0x0e], cmos[0x33]);
printf("│ 0f │ %02X │ Shutdown status ║34-3f │ │ Reserved │\n", cmos[0x0f]);
printf("│ 10 │ %02X │ Diskette type (A & B) ║ │ │ %02X %02X %02X %02X %02X %02X %02X %02X │\n",
cmos[0x10], cmos[0x34], cmos[0x35], cmos[0x36], cmos[0x37], cmos[0x38],
cmos[0x39], cmos[0x3a], cmos[0x3b]);
printf("│ 11 │ %02X │ Reserved ║ │ │ %02X %02X %02X %02X │\n",
cmos[0x11], cmos[0x3c], cmos[0x3d], cmos[0x3e], cmos[0x3f]);
printf("│ 12 │ %02X │ Fixed Disk type (C & D) ║ │ ├─────────────────────────┤\n", cmos[0x12]);
printf("│ 13 │ %02X │ Reserved ║ │ │ Use /d for descriptions │\n", cmos[0x13]);
printf("└──────┴─────┴─────────────────────────╨──────┴─────┴─────────────────────────┘");
if (argc > 1) {
if (toupper(argv[1][1]) == 'D')
printdesc();
}
}
void printdesc()
{
printf("\n\n CMOS RAM Description\n");
printf(" The setup program initializes registers A, B, C, and D when the\n");
printf(" time and date are set. Also, Interrupt 1A is the BIOS' interface\n");
printf(" to read/set the time and date which also initializes the status bytes.\n");
printf("\n\n");
printf("STATUS REGISTER A (Hex A)\n");
printf("Bit 7 Update in Progress. A 1 indicates the time update cycle is\n");
printf(" in progress. A 0 indicates current date/time available\n");
printf("Bit 6-4 22-Stage Divider. These three bits identify which time-base\n");
printf(" is being used. Default is 010, 32.786kHz time base.\n");
printf("Bit 3-0 Rate Selection Bits. These allow the selection of a divider\n");
printf(" output frequency. Default is 0110, 1.024kHz square wave and\n");
printf(" a 976.562 microsecond periodic interrupt rate.\n");
printf("\n");
printf("STATUS REGISTER B (Hex B)\n");
printf("Bit 7 Set - A 0 updates the cycle normally by advancing the count at\n");
printf(" one-per-second. A 1 aborts any update cycle in progress and\n");
printf(" the program can initialize the 14 time-bytes without any further\n");
printf(" updates occurring until a 0 is written to this bit.\n");
printf("Bit 6 Periodic Interrupt Enable. Allows an interrupt to occur at a\n");
printf(" rate specified by the rate and divider bits in register A. A\n");
printf(" 1 enables an interrupt, a 0 disables it. Default is 0.\n");
printf("Bit 5 Alarm Interrupt Enable. A 1 enables the alarm interrupt, and\n");
printf(" a 0 disables it. Default is 0.\n");
printf("Bit 4 Update-Ended Interrupt Enabled. A 1 enables the update-ended\n");
printf(" interrupt, and a 0 disables it. Default is 0.\n");
printf("Bit 3 Square Wave Enabled. A 1 enables the square-wave frequency as\n");
printf(" set by the rate selection bits in register A, and a 0 disables\n");
printf(" the square wave. Default is 0.\n");
printf("Bit 2 Date Mode. Indicates whether the date/time is in binary or BCD\n");
printf(" format. A 1 indicates binary, and a 0 BCD. Default is 0.\n");
printf("Bit 1 24/12. A 1 indicates hours in 24-hour mode and a 0 indicates\n");
printf(" the 12-hour mode. Default is 1.\n");
printf("Bit 0 Daylight Savings Enabled. A 1 enables daylight savings and a\n");
printf(" 0 disables it. Default is 0.\n");
printf("\n");
printf("STATUS REGISTER C (Hex C)\n");
printf("Bit 7-4 IRQF, PF, AF, UF - These flag bits are read only and are affected\n");
printf(" when the 'AIE', 'PIE', and 'UIE' interrupts are enabled in\n");
printf(" register B.\n");
printf("Bit 3-0 Reserved\n");
printf("\n");
printf("STATUS REGISTER D (Hex D)\n");
printf("Bit 7 Valid RAM Bit - Indicates the condition of the contents of the\n");
printf(" CMOS RAM through the power sense pin. A low state of the power\n");
printf(" sense pin indicates that the real-time clock has lost its power\n");
printf(" (battery dead). A 1 on the VRB indicates ok and a 0 indicates\n");
printf(" that the real-time clock has lost power.\n");
printf("Bit 6-0 Reserved\n");
printf("\n");
printf("DIAGNOSTIC STATUS BYTE (Hex E)\n");
printf("Bit 7 Real-Time clock lost power if a 1.\n");
printf("Bit 6 Configuration Record - Checksum ok if a 0.\n");
printf("Bit 5 Incorrect Configuration Information if a 1.\n");
printf("Bit 4 Memory Size Miscompare if a 1.\n");
printf("Bit 3 Fixed Disk Adapter/Drive C Initialization Status, 1 if failed.\n");
printf("Bit 2 Time Status Indicator - (POST Validity check), 1 if invalid.\n");
printf("Bit 1-0 Reserved\n");
printf("\n");
printf("SHUTDOWN STATUS BYTE (Hex F)\n");
printf("Defined by the power on diagnostics. See BIOS listing.\n");
printf("\n");
printf("DISKETTE DRIVE TYPE BYTE (Hex 10)\n");
printf("Bit 7-4 Type of first diskette drive installed:\n");
printf(" 0000 - No drive present\n");
printf(" 0001 - Double Sided (48 TPI)\n");
printf(" 0010 - High Capacity (96 TPI)\n");
printf("Bit 3-0 Type of second diskette drive installed.\n");
printf("\n");
printf("FIXED DISK TYPE BYTE (Hex 12)\n");
printf("Bit 7-4 Defines the type of first fixed disk drive (drive C:):\n");
printf(" 0000 - No fixed disk drive is present\n");
printf(" 0001 - 1111 defines type 1 through type 15\n");
printf("Bit 3-0 Defines the type of second fixed disk drive (drive D:)\n");
printf("\n");
printf("EQUIPMENT BYTE (Hex 14)\n");
printf("Bit 7-6 Number of diskette drives installed: 00 - 1 drive; 01 - 2 drives\n");
printf("Bit 5-4 Primary display: 00-Reserved; 01-CGA 40; 10-CGA 80; 11-Mono\n");
printf("Bit 3-2 Not used\n");
printf("Bit 1 Math Coprocessor present if 1\n");
printf("Bit 0 Diskette drives are installed if 1\n");
printf("\n");
printf("LOW AND HIGH BASE MEMORY BYTES (Hex 15 and 16)\n");
printf("Bit 7-0 Hex 15 - Low byte\n");
printf("Bit 7-0 Hex 16 - High byte\n");
printf(" Valid Sizes:\n");
printf(" 0100H 256Kb system-board RAM\n");
printf(" 0200H 512Kb system-board RAM\n");
printf(" 0280H 640Kb system-board RAM\n");
printf("\n");
printf("LOW AND HIGH MEMORY EXPANSION BYTES (Hex 17 and 18)\n");
printf("Bit 7-0 Hex 17 - Low byte\n");
printf("Bit 7-0 Hex 18 - High byte\n");
printf(" Valid Sizes:\n");
printf(" 0200H 512Kb I/O adapter\n");
printf(" 0400H 1024Kb I/O adapter\n");
printf(" 0600H 1536Kb I/O adapter\n");
printf(" to\n");
printf(" 3C00H 15360Kb I/O adapter (15Mb maximum)\n");
printf("\n");
printf("CHECKSUM (Hex 2E and 2F)\n");
printf("Address hex 2E High Byte\n");
printf("Address hex 2F Low Byte\n");
printf(" Note: Checksum is on addresses hex 10-20.\n");
printf("\n");
printf("LOW AND HIGH EXPANSION MEMORY BYTES (Hex 30 and 31)\n");
printf("Same meaning as Hex 17 and 18 but value found during POST.\n");
printf("\n");
printf("DATE CENTURY BYTE (Hex 32)\n");
printf("Bit 7-0 BCD value for the century.\n");
printf("\n");
printf("INFORMATION FLAG (Hex 33)\n");
printf("Bit 7 Set if 128KB memory option is installed.\n");
printf("Bit 6 Used by the Setup utility to put out a first user message after\n");
printf(" initial setup.\n");
printf("Bit 5-0 Reserved\n");
printf("\n");
printf("I/O OPERATIONS\n");
printf("Writing to CMOS RAM involves two steps:\n");
printf(" 1. OUT to port hex 70 with a CMOS address that will be written to.\n");
printf(" 2. OUT to port hex 71 with the data to be written.\n");
printf("\n");
printf("Reading CMOS RAM involves two steps:\n");
printf(" 1. OUT to port hex 70 with the CMOS address that is to be read from.\n");
printf(" 2. IN from port hex 71, and the data read is returned in AL.\n");
}